package com.ryqg.jiaofu.domain.pagequery.pdfinfo;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;

@Getter
@AllArgsConstructor
public enum TabEnum {
    LATEST_UPLOAD("latest_upload", "最新上传"),
    HOT_DOWNLOAD("hot_download", "热门下载"),
    VIEW_PRIORITY("view_priority", "浏览优先"),
    COLLECT_PRIORITY("collect_priority", "收藏优先");

    private final String code;
    private final String desc;

    public static TabEnum fromCode(String code) {
        return Arrays.stream(values())
                .filter(e -> e.getCode().equals(code))
                .findFirst()
                .orElse(LATEST_UPLOAD);
    }

    @Override
    public String toString() {
        return this.code;
    }
}